#include"app.h"

#include"crc16.h"


u16 crc16 = 0xffff;
void crc16_reset(void)
{
    crc16 = 0xffff;
}
void crc16_stream(u8 d)
{
    u8 j;
    crc16 ^= d;
    for (j = 0; j < 8; j++)
    {
        if (crc16 & 0x0001)
        {
            crc16 >>= 1;
            crc16 ^= 0xA001;
        }
        else
        {
            crc16 >>= 1;
        }
    }
}
